﻿using System;
using System.Collections.Generic;
using MugenInjection.Infrastructure;

namespace MugenInjection.Interface
{
    /// <summary>
    ///     Represents the interface that can convert types when binding activating.
    /// </summary>
    public interface IDynamicConverter
    {
        /// <summary>
        ///     Gets the service types.
        /// </summary>
        IList<Type> Services { get; }

        /// <summary>
        ///     Determines whether the specified request can be resolved.
        /// </summary>
        /// <param name="bindingContext">
        ///     The specified <see cref="IBindingContext" />.
        /// </param>
        /// <param name="convertType">The type to convert.</param>
        /// <returns>
        ///     <c>True</c> if the specified service has been resolved; otherwise, <c>false</c>.
        /// </returns>
        bool CanResolve(IBindingContext bindingContext, out Type convertType);

        /// <summary>
        ///     Resolves instance for the specified <see cref="IBindingContext" />.
        /// </summary>
        /// <param name="context">
        ///     The specified <see cref="ConverterContext" />.
        /// </param>
        /// <returns>An instance of the service.</returns>
        object Resolve(ConverterContext context);
    }
}